#!/usr/bin/python


from most_basic_conf_filters import FILTER_CONFIG


class ConfigProcessor(object):
    def __init__(self):
        self.__ITERTYPES__ = (dict, list, tuple, iter)

    def checkroot(self, confroot):
        if len(confroot) == 0:
            raise ValueError('empty settings')
        if type(confroot) != dict:
            raise ValueError('config must but type dict')


    def printkeys(self, conf):
        levelkeys = conf.keys()
        key = levelkeys.pop()
        while type(conf[key]) != dict:
            if len(levelkeys) == 0:
                return None
            print(key)
            key = levelkeys.pop()
        #if len(levelkeys) == 0:
        #    return None
        #key = levelkeys.pop()
        #while type(conf[key]) != dict and len(levelkeys) != 0:
        #    key = levelkeys.pop()
        self.printkeys(conf[key])
        print(key)


cp = ConfigProcessor()
cp.checkroot(FILTER_CONFIG) 
cp.printkeys(FILTER_CONFIG)
